home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.n / proc.n < prev    next >
Text File  |  1995-07-25  |  4KB  |  133 lines

  1.  
  2.  
  3.  
  4.      pppprrrroooocccc((((nnnn))))                      TTTTccccllll (((( ))))                      pppprrrroooocccc((((nnnn))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           proc - Create a Tcl procedure
  12.  
  13.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.           pppprrrroooocccc _n_a_m_e _a_r_g_s _b_o_d_y
  15.      _________________________________________________________________
  16.  
  17.  
  18.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  19.           The pppprrrroooocccc command creates a new  Tcl  procedure  named  _n_a_m_e,
  20.           replacing  any  existing command or procedure there may have
  21.           been by that name.  Whenever the new command is invoked, the
  22.           contents  of  _b_o_d_y  will be executed by the Tcl interpreter.
  23.           _A_r_g_s specifies the formal arguments to  the  procedure.   It
  24.           consists  of  a list, possibly empty, each of whose elements
  25.           specifies one argument.  Each argument specifier is  also  a
  26.           list  with  either  one  or  two fields.  If there is only a
  27.           single field in the specifier then it is  the  name  of  the
  28.           argument;  if  there  are  two fields, then the first is the
  29.           argument name and the second is its default value.
  30.  
  31.           When _n_a_m_e is invoked a local variable will  be  created  for
  32.           each  of  the  formal  arguments to the procedure; its value
  33.           will be the value of corresponding argument in the  invoking
  34.           command  or  the  argument's  default value.  Arguments with
  35.           default  values  need  not  be  specified  in  a   procedure
  36.           invocation.   However, there must be enough actual arguments
  37.           for all the formal arguments that don't have  defaults,  and
  38.           there  must not be any extra actual arguments.  There is one
  39.           special case to permit procedures with variable  numbers  of
  40.           arguments.   If  the last formal argument has the name aaaarrrrggggssss,
  41.           then a  call  to  the  procedure  may  contain  more  actual
  42.           arguments than the procedure has formals.  In this case, all
  43.           of the actual arguments starting at the one  that  would  be
  44.           assigned  to  aaaarrrrggggssss  are combined into a list (as if the lllliiiisssstttt
  45.           command had been used); this combined value is  assigned  to
  46.           the local variable aaaarrrrggggssss.
  47.  
  48.           When _b_o_d_y is being executed, variable names  normally  refer
  49.           to  local  variables,  which  are created automatically when
  50.           referenced and deleted  when  the  procedure  returns.   One
  51.           local  variable  is  automatically  created  for each of the
  52.           procedure's  arguments.   Global  variables  can   only   be
  53.           accessed  by  invoking  the  gggglllloooobbbbaaaallll  command  or  the  uuuuppppvvvvaaaarrrr
  54.           command.
  55.  
  56.           The pppprrrroooocccc command returns an empty string.  When a  procedure
  57.           is  invoked,  the  procedure's  return  value  is  the value
  58.           specified in a rrrreeeettttuuuurrrrnnnn command.   If  the  procedure  doesn't
  59.           execute  an  explicit  rrrreeeettttuuuurrrrnnnn,  then its return value is the
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/17/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      pppprrrroooocccc((((nnnn))))                      TTTTccccllll (((( ))))                      pppprrrroooocccc((((nnnn))))
  71.  
  72.  
  73.  
  74.           value of the last command executed in the procedure's  body.
  75.           If  an error occurs while executing the procedure body, then
  76.           the procedure-as-a-whole will return that same error.
  77.  
  78.  
  79.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  80.           argument, procedure
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/17/95)
  130.  
  131.  
  132.  
  133.